<template>
    <div>
    <el-dropdown style="position: absolute;
    right: 30;">
        <span class="el-dropdown-link">
            <div class="block" style="font-size: 16px;color:aliceblue;">
                <el-avatar style="margin-top: 10px;" :size="40" :src="txjpg" /><span class="account">{{account}}</span><i class="el-icon-arrow-down el-icon--right"></i>
            </div>
        </span>
        <template #dropdown>
            <el-dropdown-menu>
                <el-dropdown-item >修改资料</el-dropdown-item>
                <el-dropdown-item divided>修改密码</el-dropdown-item>
                <el-dropdown-item divided @click="outLogins">退出登录</el-dropdown-item>
            </el-dropdown-menu>
        </template>
    </el-dropdown>
</div>
</template>
<script lang="ts" setup>
import txjpg   from '@/assets/0002.jpg';
import router from '@/router';
import { accountStore,tokenStore,loginStore } from '@/store/modules/user'
import { outLogin } from '@/api/Login'

onMounted(()=>{
    account.value=accountStore().account;
})
let account =ref();
const outLogins = () => {
    const account:string=accountStore().account
    outLogin({account:account})
    accountStore().setAccount('')
    tokenStore().setToken('')
    loginStore().setLoginStatus(false)
    router.replace("/")
}
</script>
<style scoped>
.example-showcase .el-dropdown-link {
    cursor: pointer;
    color: var(--el-color-primary);
    display: flex;
    align-items: center;
}
.account{
    position: relative;
    left: 5px;
    bottom: 15px;
}
</style>